package com.example.literj.kt.internal.disposables

import com.example.literj.kt.disposables.Disposable
import java.util.concurrent.atomic.AtomicReference

class SequentialDisposable : AtomicReference<Disposable>(), Disposable {
    override fun dispose() {
        DisposableHelper.dispose(this)
    }

    override fun isDisposed() = DisposableHelper.isDisposed(get())

    fun replace(next: Disposable?): Boolean {
        return DisposableHelper.replace(this, next)
    }
}